const axios = require('axios');

module.exports = async (data, options) => {
    const [shopId] = data;
    // 先获取店铺ID对应的名称
    const {data:listData} = await axios.post('https://api.diankeduo.cn/zhili/query/businessInfoList', {
        appKey: '4',
        serviceName: '经营神器-美团',
        platform: 8,
        param: shopId,
        pageSize: 1,
        pageIndex: 1
    });
    if (!listData.result) {
        console.log(listData);
        return;
    }
    const {list} = listData.result;
    if (!list.length) {
        console.log('店铺不存在');
        return;
    }
    // 接下来获取店铺地址
    const {data: loginData} = await axios.post('https://api.diankeduo.cn/zhili/occ/order/replaceUserLogin', {
        appKey: '4',
        memberId: shopId,
        platform: 8
    });
    open(loginData.result);
}